package com.qqtech.qquan.user.dao;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.qqtech.core.frame.dao.BaseDaoImpl;
import com.qqtech.qquan.user.model.UserTopic;

@Repository
public class UserTopicDaoImpl extends BaseDaoImpl<UserTopic> implements UserTopicDao {
	public static final Logger log = LoggerFactory.getLogger(UserTopicDaoImpl.class);

	@Override
	public int increasePv(int topicId, int pv) {
		UserTopic topic = new UserTopic();
		topic.setId(topicId);
		topic.setPv(pv);
		return sqlSessionTemplate.update(getSqlName("increasePv"), topic);
	}

	@Override
	public int increaseComment(Integer topicId, int addCount) {
		UserTopic topic = new UserTopic();
		topic.setId(topicId);
		topic.setCommentCount(addCount);
		return sqlSessionTemplate.update(getSqlName("increaseComment"), topic);
	}

	@Override
	public int increasePraise(Integer topicId, int addCount) {
		UserTopic topic = new UserTopic();
		topic.setId(topicId);
		topic.setPraiseCount(addCount);
		return sqlSessionTemplate.update(getSqlName("increasePraise"), topic);
	}
	
}
